import React from 'react'
// ===================================================================== Temp
import FormModal from '#cpt/temp/FormModal'
// ===================================================================== global declare
const { $fn, $Lazy } = window
// ===================================================================== Lazy
const $cache 	= $Lazy.file(()=>import('#private/cache-api'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		selectedKeys:[],
		//修改账期
		formData:[
			{ label: '账期',			name: 'bill_phase_id', 	type: 'select', 	full:true,	loading:true, mode:'multiple', required:true },
			{ label: '开始时间',		name: 'start_at', 		type: 'date-time', 	half:true },
			{ label: '结束时间',		name: 'end_at', 		type: 'date-time', 	half:true },
		]
	}
	
	model = {}
	
	open = (data) => {
		this.modal.open({ formRef:this.formRef })
		this.getSelect(data)
	}

	// 获取下拉数据
	getSelect = (data) => {
		const { formData } = this.state
		$cache.then( async f => {
			// 账期
			$fn.setRow(formData, 'bill_phase_id', data ) 
			this.setState({ formData })
		})
	}
	
	render(){
		return FormModal.call(this,{ title:'一键审核', api: 'bill/auditall', getSubmit:(param)=>{
			param.bill_phase_id = String(param.bill_phase_id)
			return param
		}})
	}
}

export default Index